#include "regx52.h"
#define Work1
//#define Work2
unsigned int Count=0;
unsigned char Flag=0;
void main()
{
	TMOD=0x02;
    TL0=0x9c;
    TH0=0x9c;
    ET0=1;
    EA=1;
    TR0=1;
    while(1)
    {
    #ifdef Work1
        P2=0x01<<Flag;
    #endif
    #ifdef Work2
      if(Flag==0)P2=0xaa;
      else P2=0x55;
    #endif
    }
}

void time0_service(void) interrupt 1
{
    Count++;
    if(Count==5000)
    {
        Count=0;
        Flag++;
        #ifdef Work1
        if(Flag==8)Flag=0;
        #endif
        #ifdef Work2
        if(Flag==2)Flag=0;
        #endif
    }

}
